Skip to content

fix: use canonical www.codebuff.com URL for fallbacks - #840

Open
OmarAlaaeldein wants to merge 1 commit into
CodebuffAI:mainfrom
OmarAlaaeldein:fix/codebuff-app-url-redirect
Open

fix: use canonical www.codebuff.com URL for fallbacks#840
OmarAlaaeldein wants to merge 1 commit into
CodebuffAI:mainfrom
OmarAlaaeldein:fix/codebuff-app-url-redirect

Conversation

@OmarAlaaeldein

Copy link
Copy Markdown

This PR fixes a silent authorization header-stripping issue during local development/testing.

  • Change hardcoded fallback URLs from https://codebuff.com to the canonical https://www.codebuff.com.
  • This prevents the 301 redirect from codebuff.com to www.codebuff.com which causes Node's fetch client to strip the Authorization header for security reasons, resulting in a silent 401 Unauthorized error.

When fallback URLs point to codebuff.com, the server redirects to
www.codebuff.com with a 301 redirect. During this redirect, Node's
fetch client strips the Authorization header (for security reasons),
causing validation/session requests to fail with a 401 Unauthorized.

This changes hardcoded fallbacks to the canonical www.codebuff.com
to avoid redirect-induced credential stripping.
@codebuff-team

Copy link
Copy Markdown
Contributor

Good catch and a minimal, focused diff. Using https://codebuff.com as a fallback when it 301-redirects to www.codebuff.com is a real footgun for fetch, which drops Authorization headers on cross-origin redirects per the Fetch spec's redirect handling for sensitive headers. Switching the fallback to the canonical www.codebuff.com in cli/src/hooks/use-freebuff-session.ts and cli/src/utils/error-handling.ts avoids the redirect entirely, and the doc-comment update in sdk/src/validate-agents.ts keeps the example consistent.

A few things worth checking before porting:

  • Confirm https://www.codebuff.com is actually the domain that serves /api/v1/... — if the API is hosted only on the bare domain and www is just a marketing redirect, this could break things instead of fixing them. Worth a quick curl/test against both endpoints.
  • No test coverage is added, though given the size and nature (a literal fallback string swap) that's understandable and probably not blocking for a maintainer to port by hand.
  • It would help to also check if there are other places in the codebase using the same codebuff.com fallback pattern (e.g. web/ or shared config) that weren't touched here, even though those are out of scope for this mirror — a maintainer porting this should search for consistency.

Overall this is small, well-reasoned, and easy to verify/port by hand.

@codebuff-team codebuff-team added bot:triaged Classified by the community triage bot pr:port-candidate Worth porting into the private source tree labels Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:triaged Classified by the community triage bot pr:port-candidate Worth porting into the private source tree

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants